home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_12_03
/
kamradt
/
inline2.h
< prev
next >
Wrap
Text File
|
1994-02-07
|
1KB
|
36 lines
Figure 4a. Splitting functions to facilitate inlining.
5.1274 10000 Widget *WidgetHome::GetWidgetPointer()
{
1.0333 10000 if(widgetPtr == NULL)
{
0.0012 10 widgetPtr = new Widget;
0.0013 10 if(widgetPtr == NULL ||
widgetPtr->isError())
0.0000 0 return NULL;
}
1.0237 10000 return widgetPtr;
3.5429 10000 }
Figure 4b. Inlining only the part called most often.
// the inline doesn't show up on the profile count:
inline Widget *WidgetHome::GetWidgetPointer()
{
return widgetPtr ?
widgetPtr :
PrivateGetWidgetPointer();
}
0.0020 10 Widget *WidgetHome::PrivateGetWidgetPointer();
{
0.0059 10 widgetPtr = new Widget;
0.0035 10 if(widgetPtr == NULL ||
widgetPtr->isError())
0.0000 0 return NULL;
0.0008 10 return widgetPtr;
0.0001 10 }